package com.gg.star.contorller;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;

import com.gg.entity.User;
import com.gg.star.service.StarService;

import helpers.baseservlet.BaseServlet;
import povos.StarFruitPovo;

@WebServlet("/star/RemoveStarBySidServlet")
public class RemoveStarBySidServlet extends BaseServlet {
	@Autowired
	private StarService starService;
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String sid =request.getParameter("sid");
		starService.removeStarBySid(sid);
		User user=(User)  request.getSession().getAttribute("user");
		String uid=user.getUid();
		List<StarFruitPovo> povos=starService.showAllStarsByUid(uid);
		request.getSession().setAttribute("povos",povos);
		response.sendRedirect("/fruits/showstar.jsp");


}}
